package com.leyou.page.controller;

import com.leyou.page.service.PageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("page")
public class PageController {

    @Autowired
    private PageService pageService;
//查询商品spu数据
    @GetMapping("/spu/{id}")
    public ResponseEntity<String> querySpuLoadData(@PathVariable("id") Long id){
        return ResponseEntity.ok(pageService.spuLoadData(id));
    }
//    查询商品sku数据
    @GetMapping("/sku/{id}")
    public ResponseEntity<String> querySkuPageData(@PathVariable("id") Long spuId){

        return ResponseEntity.ok(pageService.loadSkuListData(spuId));
    }
//查询商品spuDetail数据
    @GetMapping("/detail/{id}")
    public ResponseEntity<String> querySpuDetailData(@PathVariable("id") Long spuId){

        return ResponseEntity.ok(pageService.loadSpuDatailData(spuId));
    }
   /*
   *查询商品分类数据
   * */
   @GetMapping("/categories")
    public ResponseEntity<String> queryCategoryPageData(@RequestParam("ids") List<Long> ids){
       return ResponseEntity.ok(pageService.loadCategoriesData(ids));
   }

   /*
   * 查询品牌信息
   * */
   @GetMapping("/brand/{id}")
    public ResponseEntity<String> queryBrandPageData(@PathVariable("id") Long id){

       return ResponseEntity.ok(pageService.loadBrandData(id));
   }
/*
* 查询规格数据
* */
        @GetMapping("/spec/{id}")
    public ResponseEntity<String> queryGoodsPageData(@PathVariable("id") Long categoryId){

            return ResponseEntity.ok(pageService.loadSpecData(categoryId));

        }


}
